--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 72db6e0ef2e9da96b5f164eb7c37ddbf3022bdec
Parents : b706888
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Signature : T66BB85Valid, signed by author
Date : 2026-07-06T19:23:45+02:00
Ensure link traffic stats consistency
Changes
Diff
diff --git a/RNS/Packet.py b/RNS/Packet.py
index 761af5fc8..00ee0aa81 100755
--- a/RNS/Packet.py
+++ b/RNS/Packet.py
@@ -278,6 +278,7 @@ class Packet:
:returns: A :ref:`RNS.PacketReceipt<api-packetreceipt>` instance if *create_receipt* was set to *True* when the packet was instantiated, if not returns *None*. If the packet could not be sent *False* is returned.
"""
if not self.sent:
+ if not self.packed: self.pack()
if self.destination.type == RNS.Destination.LINK:
if self.destination.status == RNS.Link.CLOSED:
RNS.log("Attempt to transmit over a closed link, dropping packet", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
@@ -288,9 +289,7 @@ class Packet:
else:
self.destination.last_outbound = time.time()
self.destination.tx += 1
- self.destination.txbytes += len(self.data)
-
- if not self.packed: self.pack()
+ self.destination.txbytes += len(self.ciphertext)
if RNS.Transport.outbound(self): return self.receipt
else:
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────